/*
 * [Ronny Abraham]
 * [ronnya@gmail.com]
 * CS530:DUI, Assignment [#1]
 */

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;

/*
 * ActorEditorController
 */

public class ActorEditorController
{

	ActorEditorController(ActorsController controller, Actor actor, IActorChangeExecutor changeExecutor)
	{
		itsInputActor = actor;
		itsIActorChangeExecutor = changeExecutor;
	}
	
	public JDialog createView(JFrame parentFrame)
	{
		itsPreviewController = new PreviewController();
		JPanel previewPanel = itsPreviewController.createView(itsInputActor);
		itsActorEditorView = new ActorEditorView(this, itsInputActor, previewPanel, parentFrame);
		return itsActorEditorView.itsDialog;
	}
	
	/*
	 * actorChanged
	 * called after the user modifies an actor and hits 'OK' 
	 */
	public void actorChanged(Actor actor)
	{
		itsIActorChangeExecutor.ActorChanged(actor);
	}
	
	public PreviewController itsPreviewController;
	private ActorEditorView itsActorEditorView;
	private Actor itsInputActor;
	private boolean addOnActorchanged = true;
	private IActorChangeExecutor itsIActorChangeExecutor;
}
